﻿using Abp.Dependency;
using Castle.Core;

namespace AbpProjectTemplate.Components.Payments
{
    public static class PaymentHelpers
    {
        public static void RegisterPayment(this IIocManager iocManager)
        {
            iocManager.IocContainer.Kernel.ComponentRegistered += (key, handler) =>
            {
                if (typeof(IPaymentApi).IsAssignableFrom(handler.ComponentModel.Implementation))
                {
                    handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(PaymentApiInterceptor)));
                }
            };
        }
    }
}